using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

/// <summary>
/// Summary description for clsketnoi
/// </summary>
public class clsketnoi: System.Web.UI.Page
{
    SqlConnection con = new SqlConnection();

	public clsketnoi()
	{
		//
		// TODO: Add constructor logic here
		//
	}

    public void ketnoi()
    {
        try
        {
            con.ConnectionString = "Data Source=(local);Initial Catalog=QLTV; Integrated Security=true";
            con.Open();
        }
        catch (Exception ex)
        {
            throw ex;
           
        }
    }

    public void dongketnoi()
    {
        try
        {
            con.Close();
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }

    public DataSet Thuchientryvan(string sql)
    {
        try
        {
            ketnoi();
            DataSet ds = new DataSet();
            SqlDataAdapter da = new SqlDataAdapter();
            da = new SqlDataAdapter(sql, con);
            da.Fill(ds, "sql");
            dongketnoi();
            return ds;
        }
        catch (Exception ex)
        {
            throw ex;
        }
       
    }
}
